package com.ldl.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.hutool.core.bean.BeanUtil;

import com.ldl.dao.LdlArticleDao;
import com.ldl.dao.impl.LdlArticleDaoImpl;
import com.ldl.entity.LdlArticle;
import com.ldl.listener.MyListener;
import com.ldl.service.LdlArticleService;
import com.ldl.vo.LdlArticleVO;

/**
 * @author Administrator
 * Author : L.D.L
 * E-mail : 1419485293@qq.com
 * Date : 2020年7月25日下午4:20:27
 */
public class LdlArticleServiceImpl implements LdlArticleService{
	
	private static Logger log1 = LoggerFactory.getLogger(LdlArticleServiceImpl.class) ;

	private LdlArticleDao ldlArticleDao = new LdlArticleDaoImpl();
	/* (non-Javadoc)
	 * @see com.ldl.service.LdlArticleService#list()
	 */
	@Override
	public List<LdlArticleVO> list(int len) {
		List<LdlArticleVO> list = new ArrayList<LdlArticleVO>();
		try {
			List<LdlArticle> list1 = ldlArticleDao.selectAll(0, len);
			list1.forEach((entity)->{
				LdlArticleVO vo = new LdlArticleVO();
				//vo.setArticleId(entity.getArticleId());
				//...
				BeanUtil.copyProperties(entity, vo);
				list.add(vo);
			});
			
		} catch (SQLException e) {
//			e.printStackTrace();
			log1.debug("{}",e);
			
		}
		return list;
	}

}
